<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>学生填表</title>
<style>
	input{
		margin:5px;
	}
</style>
<script src="js/jquery-1.11.3.min.js"></script>
</head>

<body>
	<form>
    	<label>姓名：</label><input type="text" id="uname" name="uname"/><br/>
        <label>学号：</label><input type="text" id="age" name="age"/><br/>
        <!--<input url="/servlet/Hello" type="submit" value="提交" />-->
        <input type="button" value="提交" onClick="doSubmit()"/>
    </form>
    
   <script>
   		function doSubmit(){
   			var uname=$("#uname").val();
   			var age=$("#age").val();
   			$.ajax({
	   			url:'/servlet/Hello',
	   			type:'POST',
	   			dataType:'JSON',
	   			data:{'uname':uname,'age':age},
	   			success:function(data){
   					if(data!=null&&data!=""){
   						document.write("<html><head></head><body>姓名:"+data.uname+"年龄:"+data.age+"</body></html>");
   					}
	   			}
	   		});
   		}
   </script>
</body>
</html>
